﻿using System;
using System.Collections.Generic;
using System.Text;
using TTClassLibrary;
using TTServer.Messages;
using libCommonClass;
using TTServer.Controller;

namespace TTServer.MessageProcessor
{
    public class PPTLaunchPowerpointRequestMessageProcessor : IMessageProcessor
    {
        public bool Process(libCommonClass.TTMessage message, libInterface.IClientInfoProvider clientInfoProvider)
        {
            if (message is PPTLaunchPowerpointRequestMessage)
            {   
                if (!(clientInfoProvider.Authority == AuthorityConstant.ADMIN
                    || clientInfoProvider.Authority == AuthorityConstant.KEY_MEMBER))
                {
                    return true;
                }

                PPTController pptCtrl = PPTController.Instance;

                pptCtrl.LaunchPowerpoint();

                // DoneMessage dm = new DoneMessage();
                // dm.WriteMessage(clientInfoProvider.getWriter());

                return true;
            }

            return false;
        }
    }
}
